<template>
  <div class="box">
    <div class="clearfix top">
      <p class="title">数据统计</p>
      <p class="bg"></p>
    </div>

    <div class="charts" ref="echartsRef"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'

import * as echarts from 'echarts'
const echartsRef = ref()
onMounted(() => {
  const myCharts = echarts.init(echartsRef.value)
  myCharts.setOption({
    title: {
      text: '游客消费统计',
      textStyle: {
        color: '#fff'
      }
    },
    radar: {
      // shape: 'circle',
      indicator: [
        { name: '游戏', max: 6500 },
        { name: '学习', max: 16000 },
        { name: '工作', max: 30000 },
        { name: '购物', max: 38000 },
        { name: '好感', max: 52000 },
        { name: '出行', max: 25000 }
      ]
    },
    series: [
      {
        name: 'Budget vs spending',
        type: 'radar',
        data: [
          {
            value: [4200, 3000, 20000, 35000, 50000, 18000],
            name: 'Allocated Budget'
          },
          {
            value: [5000, 14000, 28000, 26000, 42000, 21000],
            name: 'Actual Spending'
          }
        ]
      }
    ]
  })
})
</script>

<style scoped lang="scss">
.box {
  display: flex;
  flex-direction: column;
  background: #fff;
  background: url(../../images/dataScreen-main-cb.png) no-repeat;
  background-size: 100% 100%;
  overflow: hidden;
  .top {
    padding-top: 10px;
    font-size: 20px;
    margin: 0 20px;
    color: #fff;

    .bg {
      margin-top: 10px;
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
    }
  }

  .charts {
    margin-top: 30px;
    width: 100%;
    flex: 1;
  }
}
</style>
